package io.renren.modules.app.controller;

import io.renren.common.result.Result;
import io.renren.common.utils.PageUtils;
import io.renren.modules.medical.service.HealthEducationService;
import io.renren.modules.medical.vo.weixinVo.ApiHealthDetailVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 微信端健康教育的接口
 * @author Luo Sheng
 * @school YiBin university
 * @create 2023-04-17 15:23
 */
@RestController
@RequestMapping("/app/health/education")
@RequiredArgsConstructor
public class HealthEducationApi {

    private final HealthEducationService healthEducationService;

    /**
     *  获取基本健康教育
     * @param params
     * @return
     */
    @GetMapping("/list")
    public Result<PageUtils> list(@RequestParam Map<String, Object> params){
        PageUtils page = healthEducationService.getPage(params);
        return Result.success(page);
    }

    /**
     * 获取详细健康教育
     */
    @GetMapping("/detail/{id}")
    public Result<ApiHealthDetailVo> detail(@PathVariable("id") Long id){
        ApiHealthDetailVo detailVo = healthEducationService.getDetailById(id);
        return Result.success(detailVo);
    }


}
